<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../css/beiyong.css"/>
		<style type="text/css">
			
			.tou{
				
				height: auto;
				padding: 35px 40px;
				background:#fff;
				
				margin:10px 10px 20px;
				border-radius:20px;
			}
			
			.qian{
				font-size: 20px;
				font-weight: 500;
				font-family: "微软雅黑";
				text-align: center;
				color:#666;
			}
			.text{
				width: 100%;
				text-align: center;
				padding: 10px;
				color: #7c7c7c;
			}
			.fc{
				display: flex;
				justify-content: flex-start;
				align-items: flex-start;
				flex-direction: column;
			}
			.list{
				width: 100%;
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 15px 10px;;
				border-bottom: 1px solid #fff;
			}
			.qian span{color:#7EB1FD; font-size:25px;}
			/*避免闪烁*/
			[v-cloak] {
			          display: none !important;
			 }
		</style>
	</head>

	<body >
		<div id="probapp">
			<div>
		
				<header class="mui-bar mui-bar-nav hbg" >
				    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
				    <h1 class="mui-title">{{list.id == 1 ? "我的收入" :"我的提现" }}</h1>
				</header>
				<div class="mui-content" >
			<div class="tou">
					<div class="qian">
						<span>￥</span>累计{{list.id == 1 ? "收入" :"提现" }}：{{moneys}}元
					</div>
			</div>
			<div id="" class="fc">
				
			<div class="list tc" onclick="yuefen()" v-if="list.id == 1" v-for="item in wallet_list">
				<div class="">
					{{item.create_time}}
				</div>
				<div class="">
					{{item.price}}元
				</div>
			</div>
			<div class="list tc" onclick="yuefen()" v-if="list.id == 2" v-for="item in withdraw_list">
				<div class="">
					{{item.create_time}}
				</div>
				<div class="">
					{{item.money}}元
				</div>
			</div>
			
			
		</div>
			
		</div>
			</div>
		</div>
		<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		
		<script src="../js/mui.min.js"></script>
		<script type="text/javascript" src="../js/muishow.js"></script>
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/req.js" type="text/javascript" charset="utf-8"></script>
		
		<script type="text/javascript">

			mui.init();
			function yuefen(){
				mui.openWindow({
				    url: 'yuefen.html', 
				    id:'yuefen'
				 });
			}
			
		
			var app = new Vue({
				el:'#probapp',
				data: {
					wallet_list:"",
					withdraw_list:"",
					list:'',
					moneys:0
				},
				mounted(){
					
					var that = this; 
					
					
					 that.list = getrequest()
					if(that.list.id ==1){
						that.walletList();
					}else if(that.list.id == 2){
						that.withdrawCash();
					}
				},
				methods:{
					walletList(){
						var that = this;
						
						let data = {
							url:"/api/Wallet/wallet_list",
							data:{
								access_token : acctoken()||""	
							}
						}
						ajax(data,function(res){
							if(res.code == -1){
								mui.toast(res.message);
							}
							if(res.code == 1){
								console.log(res.data);
								
								that.wallet_list = res.data
								
								that.totalPrice(that.wallet_list,"price");
									
							}
						})
					},
					withdrawCash(){
						var that = this;
						
						let data = {
							url:"/api/Wallet/withdraw_list",
							data:{
								access_token : acctoken()||""	
							}
						}
						ajax(data,function(res){
							if(res.code == -1){
								mui.toast(res.message);
							}
							if(res.code == 1){
								console.log(res.data);
								
								that.withdraw_list = res.data;
								
								
								that.totalPrice(that.withdraw_list,"money");
							}
						})
					},
				
				
					totalPrice(list,price){
						var that =this;
						if(price == "price"){
							for(var i = 0; i<list.length; i++){
								that.moneys += Number(list[i].price);
							}
						}else{
							for(var i = 0; i<list.length; i++){
								that.moneys += Number(list[i].money);
							}
						}
						
					}
					
				
				
				}
			})
		</script>
	</body>

</html>